a=[0,1,2,3,4,5,6,7,8,9]
for Y in a:
    for N in a:
        if N!=Y:
            if (Y+N+N)%10==Y:
                b=a[:]
                del b[b.index(Y)]
                del b[b.index(N)]
                for T in b:
                    for E in b:
                        n=(Y+N+N)/10
                        if (T+E+E+n)%10==T:
                            if T!=E:
                                c=b[:]
                                del c[c.index(T)]
                                del c[c.index(E)]
                                for R in c:
                                    for X in c:
                                        m=(T+E+E+n)/10
                                        if (R+T+T+m)%10==X:
                                            if R!=X:
                                                d=c[:]
                                                del d[d.index(R)]
                                                del d[d.index(X)]
                                                for O in d:
                                                    for I in d:
                                                        k=(R+T+T+m)/10
                                                        if (O+k)%10==I:
                                                            if O!=I:
                                                                e=d[:]
                                                                del e[e.index(O)]
                                                                del e[e.index(I)]
                                                                for F in e:
                                                                    for S in e:
                                                                        if F+(O+k)/10==S:
                                                                            print "F",F,"O",O,"R",R,"T",T,"Y",Y,"E",E,"N",N,"S",S,"I",I,"X",X